package tutorial.java.swing;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

public class MessageDialogDemo extends JFrame{
	public MessageDialogDemo(){
		super("Demo Message Dialog");
		setSize(500,400);
		setVisible(true);
		setLocationRelativeTo(null);
		setResizable(false);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JLabel label = new JLabel("Hai Oanh");
		add(label);
		
		JButton button = new JButton("Click Here");
		add(button, "North", 1);
		
		button.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				JOptionPane.showMessageDialog(null, "Hai Love Oanh", "Title", JOptionPane.QUESTION_MESSAGE);
			}
		});
	}
	
	public static void main(String[] args){
		MessageDialogDemo m = new MessageDialogDemo();
	}
}
